using System;

using AzureContrib.WindowsAzure.Diagnostics;

using ITrace = AzureContrib.WindowsAzure.Diagnostics.ITrace;

namespace AzureContrib.WindowsAzure.Tests.Mocks
{
	/// <summary>
	/// A mock <see cref="ITraceFactory"/>.
	/// </summary>
	public class MockTraceFactory : ITraceFactory
	{
		private readonly ITrace traceToReturn;

		/// <summary>
		/// A mock <see cref="ITraceFactory"/>.
		/// </summary>
		public MockTraceFactory(ITrace traceToReturn)
		{
			this.traceToReturn = traceToReturn ?? MemoryTrace.Create();
		}

		/// <summary>
		/// A mock <see cref="ITraceFactory"/>.
		/// </summary>
		public MockTraceFactory()
			: this(null)
		{
		}

		/// <summary>
		/// A mock <see cref="ITraceFactory"/>.
		/// </summary>
		public ITrace Create(Type toLogFor)
		{
			return traceToReturn;
		}

		/// <summary>
		/// A mock <see cref="ITraceFactory"/>.
		/// </summary>
		public ITrace Create()
		{
			return traceToReturn;
		}

		/// <summary>
		/// A mock <see cref="ITraceFactory"/>.
		/// </summary>
		public ITrace Create(string @switch = null)
		{
			return traceToReturn;
		}
	}
}